package com.mike.swt.table;

import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.swt.graphics.Image;

import com.mike.bdb.util.ImageManager;
import com.mike.swt.table.model.GameWorld;
import com.mike.swt.table.model.Person;
import com.mike.swt.table.model.Team;

public class MyTreeLabelProvider implements ILabelProvider {

	@Override
	public Image getImage(Object arg0) {
		return ImageManager.getImage(ImageManager.ICON_DATABASE);
	}

	@Override
	public String getText(Object obj) {
		String result = null;
		if(obj instanceof GameWorld) {
			result = "GameWorld";
		} else if (obj instanceof Team) {
			result = "Team";
		} else if (obj instanceof Person) {
			Person p = ((Person) obj);
			result = p.getName() + ":" + p.getId();
		}
		return result;
	}

	@Override
	public void addListener(ILabelProviderListener arg0) {
	}

	@Override
	public void dispose() {
	}

	@Override
	public boolean isLabelProperty(Object arg0, String arg1) {
		return false;
	}

	@Override
	public void removeListener(ILabelProviderListener arg0) {
	}


}
